<template>
  <div class="mui-numbox" data-numbox-min="1" :data-numbox-max="max" style="height:25px">
    <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
    <input
      id="test"
      class="mui-input-numbox"
      type="number"
      :value="shopCarcount"
      @change="countChanged"
      ref="numbox"
      readonly
    >
    <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
  </div>
</template>
 
<script>
import mui from "../../lib/mui/js/mui.min.js";
export default {
  // 初始化数字选择框
  mounted() {
    mui(".mui-numbox").numbox();
  },
  created(){
   
  },
  methods: {
    countChanged() {
      //数字改变
    
      this.$store.commit("updatGoodsInfo", {
        id: this.goodsid,
        count: this.$refs.numbox.value
      });
    }
  },
  props: ["max", "shopCarcount", "goodsid"] //接收父组件传来的值
};
</script>

<style lang="scss" scoped>
</style>
